package models

import "gorm.io/gorm"

type Goods struct {
	gorm.Model
	GoodsTitle  string  `gorm:"type:varchar(50)"`
	GoodsPrice  float64 `gorm:"type:decimal(10,2)"`
	GoodsCover  string  `gorm:"type:varchar(200)"`
	GoodsSize   string  `gorm:"type:varchar(10)"`
	GoodsStock  int     `gorm:"type:int(10)"`
	CheckStatus int     `gorm:"type:int(10);default:1;comment:商品审核状态:0 未审核 1已审核 "`
	Status      int     `gorm:"type:int(10);default:1;comment:上架状态:1 已上架 0 已下架"`
}

func (g *Goods) Create() error {
	return DB.Create(&g).Error
}
func (g *Goods) Detail() error {
	return DB.Where("check_status = 1 and status = 1").First(&g).Error
}
